<!--左侧菜单栏-->
<nav class="navbar-default navbar-static-side" role="navigation">
    <div class="nav-close"><i class="fa fa-times-circle"></i>
    </div>
    <div class="sidebar-collapse">
        <ul class="nav" id="side-menu">
            <li class="nav-header">
                <div class="dropdown profile-element">
                    <span>
                        <img alt="头像" class="img-circle" src="/face/{$user_face}" onerror="this.src='/face/default/default.jpg'" width="75px" height="75"/>
                    </span>
                    <span class="clear">
                        <span class="block m-t-xs">
                            <strong class="font-bold  layui-badge layui-bg-blue">{$user_info.type}</strong>
                        </span>
                    </span>
                    <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                        <span class="text-muted text-xs block">{$user_info.username}<b class="caret"></b></span>
                    </a>
                    <ul class="dropdown-menu animated fadeInRight m-t-xs">
                        <li>
                            <a class="J_menuItem" href="{:url('teacher/index/change_face')}">更换头像</a>
                        </li>
                        <li>
                            <a class="J_menuItem" href="{:url('teacher/index/change_password')}">修改密码</a>
                        </li>
                        <li>
                            <a class="J_menuItem" href="{:url('teacher/index/person')}">个人资料</a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a id="logout">安全退出</a>
                        </li>
                    </ul>
                </div>
                <div class="logo-element">智+
                </div>
            </li>
            <li>
                <a href="#">
                    <i class="fa fa-home"></i>
                    <span class="nav-label">待办事项</span>
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                    <li>
                        <a class="J_menuItem" href="{:url('teacher/index/person')}" data-index="0">Waiting</a>
                    </li>
                </ul>

            </li>
            <li>
                <a href="#">
                    <i class="fa fa-child"></i>
                    <span class="nav-label">学生信息</span>
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                    <li>
                        <a class="J_menuItem" href="{:url('teacher/student/index')}">所有学生</a>
                    </li>
                </ul>
            </li>
            <li>
                <a href="#">
                    <i class="fa fa-globe"></i>
                    <span class="nav-label">安全</span>
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                    <li>
                        <a class="J_menuItem" href="{:url('teacher/safety/index')}">概览</a>
                    </li>
                    <li>
                        <a class="J_menuItem" href="{:url('teacher/safety/status')}">敏感操作</a>
                    </li>
                </ul>
            </li>
            <li>
                <a href="#">
                    <i class="fa fa-cogs"></i>
                    <span class="nav-label">个人设置</span>
                    <span class="fa arrow"></span>
                </a>
                <ul class="nav nav-second-level">
                    <li>
                        <a class="J_menuItem" href="{:url('teacher/index/change_face')}">更换头像</a>
                    </li>
                    <li>
                        <a class="J_menuItem" href="{:url('teacher/index/change_password')}">修改密码</a>
                    </li>
                    <li>
                        <a class="J_menuItem" href="{:url('teacher/index/person')}">更新资料</a>
                    </li>
                </ul>
            </li>
        </ul>
    </div>
</nav>
<script>
    $(document).on('click','#logout',function(){
        layer.confirm('是否退出?', {icon: 3, title:'提示'}, function(index){
            $.ajax({
                url:"{:url('index/index/logout')}",
                type:'post',
                dataType:'json',
                success:function(res){
                    if (res.data == 1) {
                        layer.msg(res.message);
                        setTimeout(window.location.href='login',2000);
                    } else if (res.data == 0) {
                        layer.open({
                            title: '退出失败'
                            ,content: res.message
                        });
                    } else {
                        layer.open({
                            title: '退出失败'
                            ,content: '出现未知错误，如果问题一直出现，您可以联系管理员'
                        });
                    }
                },error:function () {
                    layer.open({
                        title: '退出失败'
                        ,content: '当前网络环境不安全，退出失败，请调整网络环境'
                    });
                }
            })
            layer.close(index);
        });
    });
</script>